package com.zzw.simple_temple;

import com.zzw.ProduceApplication;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

/**
 * @program: Rabbitmqparent
 * @author: zhanzhewan
 * @create: 2020-03-26 08:43
 **/

@SpringBootTest(classes = ProduceApplication.class)
@RunWith(SpringRunner.class)
public class produce {

    @Autowired
    private RabbitTemplate rabbitTemplate;

    @Test
    public void testt(){
        for (int i = 0; i < 10; i++) {
            if (i%2==0){
                rabbitTemplate.convertAndSend("direct_exchange","1","我是站着玩"+i);
            }
            else {
                rabbitTemplate.convertAndSend("direct_exchange","2","我是站着玩路由建是2绑定的是directqueue2"+i);

            }
        }

    }

}
